<!-- 区域面板 -->
<template>
	<view class="container">
		<view class="body">
			<view class="column">
				<view class="item" v-for="item in province" :key="item.value" :class="{'checked': item.isChecked}">
					{{item.name}}
				</view>
			</view>
			<view class="column">
				<view class="item" v-for="item in city" :key="item.value"
					:class="{'checked': item.isChecked && !item.hasChildren, 'bold': item.isChecked}">
					{{item.name}}
				</view>
			</view>
			<view class="column">
				<view class="item" v-for="item in district" :key="item.value" :class="{'checked': item.isChecked}">
					{{item.name}}
				</view>
			</view>
		</view>

		<!-- 按钮组 -->
		<view class="footer">
			<button class="btn plain border-1px btn-transition-scale95">重 置</button>
			<button class="btn active btn-transition-scale95">确 定</button>
		</view>
	</view>
</template>

<script setup>
	import { ref } from "vue";

	const province = ref([
		{ name: '全国', value: '0', isChecked: false },
		{ name: '广东', value: '1', isChecked: true },
		{ name: '北京', value: '2', isChecked: false },
		{ name: '天津', value: '3', isChecked: false },
		{ name: '河北', value: '4', isChecked: false },
		{ name: '山西', value: '5', isChecked: false },
		{ name: '内蒙古', value: '6', isChecked: false },
		{ name: '辽宁', value: '7', isChecked: false },
		{ name: '吉林', value: '8', isChecked: false },
		{ name: '黑龙江', value: '9', isChecked: false },
		{ name: '上海', value: '10', isChecked: false },
		{ name: '江苏', value: '11', isChecked: false },
		{ name: '福建', value: '12', isChecked: false },
		{ name: '浙江', value: '13', isChecked: false },
	])

	const city = ref([
		{ name: '全广东', value: '0', isChecked: false, hasChildren: false },
		{ name: '广州', value: '1', isChecked: true, hasChildren: true },
		{ name: '韵关', value: '2', isChecked: false, hasChildren: true },
		{ name: '深圳', value: '3', isChecked: false, hasChildren: true },
		{ name: '珠海', value: '4', isChecked: false, hasChildren: true },
		{ name: '汕头', value: '5', isChecked: false, hasChildren: true },
		{ name: '佛山', value: '6', isChecked: false, hasChildren: true },
		{ name: '江门', value: '7', isChecked: false, hasChildren: true },
		{ name: '湛江', value: '8', isChecked: false, hasChildren: true },
		{ name: '肇庆', value: '9', isChecked: false, hasChildren: true },
		{ name: '惠州', value: '10', isChecked: false, hasChildren: true },
		{ name: '梅州', value: '11', isChecked: false, hasChildren: true },
	])

	const district = ref([
		{ name: '全广州', value: '0', isChecked: false },
		{ name: '荔湾区', value: '1', isChecked: true },
		{ name: '越秀区', value: '2', isChecked: false },
		{ name: '海珠区', value: '3', isChecked: false },
		{ name: '天河区', value: '4', isChecked: false },
		{ name: '白云区', value: '5', isChecked: false },
		{ name: '黄埔区', value: '6', isChecked: false },
		{ name: '番禺区', value: '7', isChecked: false },
		{ name: '花都区', value: '8', isChecked: false },
		{ name: '南沙区', value: '9', isChecked: false },
		{ name: '从化区', value: '10', isChecked: false },
		{ name: '增城区', value: '11', isChecked: false },
	])
</script>

<style lang="scss" scoped>
	.container {
		position: absolute;
		top: 192rpx;
		left: 0;
		width: 100%;
		background-color: white;
		border-radius: 0 0 20rpx 20rpx;

		.body {
			display: flex;
			height: 500rpx;

			.column {
				flex-shrink: 0;
				width: 33.3%;
				height: 100%;
				overflow-y: auto;

				.item {
					height: 70rpx;
					font-size: 26rpx;
					color: #222;
					text-align: center;
					line-height: 70rpx;
				}

				&:first-child {
					background-color: #f5f5f5;

					.item.checked {
						position: relative;
						font-weight: bold;
						background-color: white;

						&::before {
							position: absolute;
							top: 0;
							left: 0;
							width: 6rpx;
							height: 100%;
							display: block;
							content: '';
							background-color: #FE3333;
						}
					}
				}

				&:nth-child(2),
				&:nth-child(3) {
					.item {
						position: relative;

						&.bold {
							font-weight: bold;
						}

						&.checked {
							&::after {
								position: absolute;
								right: 10rpx;
								top: 50%;
								transform: translateY(-50%);
								display: block;
								font-family: 'iconfont';
								content: '\e62b';
								font-size: 28rpx;
								color: #222;
							}
						}
					}
				}
			}
		}

		.footer {
			flex-shrink: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			height: 90rpx;

			.btn {
				width: 220rpx;
				height: 70rpx;
				border-radius: 50rpx;
				font-size: 28rpx;
				text-align: center;
				line-height: 70rpx;

				&+.btn {
					margin-left: 40rpx;
				}

				&.plain {
					color: #222;
					background-color: transparent;

					&::after {
						border-radius: 100rpx;
					}
				}

				&.active {
					color: white;
					background-color: #FE3333;
				}
			}
		}
	}
</style>